package com.tj.jinzao.activity;

import android.content.Intent;
import android.support.v4.app.Fragment;
import android.view.View;

import com.tj.jinzao.R;
import com.tj.jinzao.base.BaseActivity;
import com.tj.jinzao.fragment.SearchFriendFragment;

/**
 * Created by LiuYX on 2019/4/19.]
 * 搜索好友
 */

public class SearchFriendActivity extends BaseActivity{
    private SearchFriendFragment searchFriendFragment;
    private String type;
    @Override
    public int getLayoutResource() {
        return R.layout.activity_add_friend;
    }
    @Override
    protected Fragment createFragment() {
        searchFriendFragment=SearchFriendFragment.newInstance();
        return searchFriendFragment;
    }

    @Override
    protected int getLeftButtonResId() {
        return R.mipmap.ic_back;
    }

    @Override
    protected void setupView() {
        findViewById(R.id.config).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(searchFriendFragment!=null){
                    if(getIntent().getStringExtra("type").equals("2")){
                        Intent to=new Intent();
                        to.putStringArrayListExtra("RESULT_DATA",searchFriendFragment.getList("2"));
                        to.putStringArrayListExtra("friendListPhoto",searchFriendFragment.getListPhoto());
                        setResult(RESULT_OK,to);
                        finish();
                    }else {
                        searchFriendFragment.getList("1");
                    }
                }
            }
        });
        findViewById(R.id.back_lay).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }
}
